Skip to content

feat: GeoIP support - #315

Open
hhvrc wants to merge 5 commits into
developfrom
feature/ip-enrichment-geo-vpn
Open

feat: GeoIP support#315
hhvrc wants to merge 5 commits into
developfrom
feature/ip-enrichment-geo-vpn

Conversation

@hhvrc

@hhvrc hhvrc commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@hhvrc hhvrc self-assigned this Jun 13, 2026
Copilot AI review requested due to automatic review settings June 13, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GeoIP-based IP enrichment (ASN org, VPN heuristic, country/city) and stores/returns this metadata alongside login sessions.

Changes:

  • Add IpEnrichmentService (MaxMind GeoLite2 ASN/City DB support) plus related options/interfaces/data model.
  • Extend session creation/storage/response mapping to include enrichment fields (AsnOrg, IsVpn, CountryCode, City).
  • Wire up DI + configuration registration and call enrichment during session creation.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Directory.Packages.props Adds central package version for MaxMind.GeoIP2.
Common/Common.csproj Adds MaxMind.GeoIP2 package reference to Common.
Common/Services/Geo/IIpEnrichmentService.cs Introduces enrichment service abstraction.
Common/Services/Geo/IpEnrichmentService.cs Implements GeoLite2 DB loading + enrichment logic + VPN heuristic.
Common/Services/Geo/IpEnrichmentData.cs Adds enrichment DTO/record.
Common/Options/GeoOptions.cs Adds configuration options for GeoLite2 DB paths.
Common/Extensions/ConfigurationExtensions.cs Adds RegisterGeoOptions() builder extension.
Common/OpenShockServiceHelper.cs Registers IIpEnrichmentService in DI.
Common/OpenShockControllerBase.cs Enriches remote IP and passes enrichment into session creation.
Common/Services/Session/ISessionService.cs Extends CreateSessionAsync signature to accept optional enrichment.
Common/Services/Session/SessionService.cs Persists enrichment fields into LoginSession.
Common/Redis/LoginSessions.cs Adds enrichment fields to Redis session model.
API/Program.cs Registers geo options during API startup.
API/Models/Response/LoginSessionResponse.cs Exposes enrichment fields in API session response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Common/OpenShockServiceHelper.cs
Comment thread Common/Services/Geo/IpEnrichmentService.cs
Comment thread Common/Options/GeoOptions.cs
@hhvrc
hhvrc marked this pull request as draft June 13, 2026 19:01
# Conflicts:
#	API/Program.cs
#	Common/Extensions/ConfigurationExtensions.cs
@ghost

ghost commented Jul 1, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Add GeoIP dependencies and configuration options
2 Implement IP enrichment service
3 Update session models for GeoIP data
4 Integrate enrichment into session creation
5 Wire services and trigger enrichment in controllers
Open in Stage

Chapters generated by Stage for commit b24627d on Jul 1, 2026 2:34pm UTC.

hhvrc and others added 2 commits July 1, 2026 16:33
- Register a default GeoOptions via TryAddSingleton in AddOpenShockServices so
  hosts that don't call RegisterGeoOptions() (Cron, LiveControlGateway, SeedE2E)
  can still activate IIpEnrichmentService instead of failing DI at startup.
- Make IpEnrichmentData.IsVpn nullable so an unavailable/failed ASN lookup stays
  'unknown' (null) rather than being recorded as 'not VPN' (false).
- Rename GeoOptions section to 'OpenShock:Geo' to match the repo's config convention.
…ent-geo-vpn

# Conflicts:
#	Common/OpenShockControllerBase.cs
#	Common/OpenShockServiceHelper.cs
#	Common/Services/Session/ISessionService.cs
#	Common/Services/Session/SessionService.cs
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hhvrc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b830ea84-f877-45bc-8ee1-724c2d8098b2

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd1fdd and dc76755.

📒 Files selected for processing (14)
  • API/Models/Response/LoginSessionResponse.cs
  • API/Program.cs
  • Common/Common.csproj
  • Common/Extensions/ConfigurationExtensions.cs
  • Common/OpenShockControllerBase.cs
  • Common/OpenShockServiceHelper.cs
  • Common/Options/GeoOptions.cs
  • Common/Redis/LoginSessions.cs
  • Common/Services/Geo/IIpEnrichmentService.cs
  • Common/Services/Geo/IpEnrichmentData.cs
  • Common/Services/Geo/IpEnrichmentService.cs
  • Common/Services/Session/ISessionService.cs
  • Common/Services/Session/SessionService.cs
  • Directory.Packages.props

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hhvrc
hhvrc marked this pull request as ready for review August 14, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants